Skip to content

refactor(scripts): remove search from the lists that new-feature writes - #395

Merged
pdevito3 merged 1 commit into
mainfrom
refactor/new-feature-no-search
Nov 1, 2026
Merged

pdevito3 merged 1 commit into
mainfrom
refactor/new-feature-no-search

Conversation

@pdevito3

@pdevito3 pdevito3 commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Why

A list in the template has two ways to query by text: a search param and QueryKit filters. QueryKit 1.17.1 (#394) lets a filter hold any text, so one path is enough. This PR removes search from each list that scripts/new-feature.cs writes. Lists then use only filters on HTTP, MCP, and gRPC. A later PR removes search from the workshop and venue examples, the SPA, and their docs.

What changed

The generator no longer writes these items:

  • SearchMaxLength, Search, and the search argument of From on the parameters DTO.
  • The ILike search block in the list handler.
  • The search param on HTTP and MCP, and optional string search = 5 on gRPC. Field 5 is dropped, not reserved, because the generator writes only new protos and never edits one that exists.

The MCP filters description now tells a caller how to write text with a ": a raw string with one space on each side, status @=* """ say "hi" """.

The help text and the backend-feature skill now say that the list sorts by the first field, and no longer that it searches by it.

Tests

  • The generated list test now queries through filters. It proves that @=* ignores case, reads %, _, and \ as plain text, and keeps a quote at the start or the end of the text. It also covers text with """ in it, which needs a four-quote delimiter.
  • The new shared helper QueryKitText.Quote in SharedTestHelpers/Utilities builds the literal. It uses the same rule as the frontend quoteText.
  • The generated max-length test for search is gone. QueryKitInputExtensionsTests and QueryInputErrorTests already cover the filters limit.
  • NewFeatureTextTests expects the new MCP description.

Local runs

  • I ran the steps of the new-feature CI job locally with the examples kept: 0 warnings, 2208 of 2208 tests passed.
  • I ran the same steps with the examples removed: 1999 of 1999 tests passed. This run was before the last review fixes, which change only the generated list test and the shared helper.

A generated list now has one query path for text: QueryKit filters. A
caller writes any text as a raw string with one space of padding on each
side, so the search parameter, its max length, and its LikePattern code
are gone from the parameters DTO, the handler, and the HTTP, MCP, and
gRPC entrypoints.

The MCP filters description shows how to write text with a quote. The
list query test now proves through a padded raw string filter that the
text is found with no regard to case, that %, _, and \ are plain text,
and that a quote at the start or end of a value, or a run of three
quotes, is part of the value. The gRPC test lists by an id filter.

The generated proto has no field 5. A generated proto is a new
contract, and the script never rewrites a feature that exists, so no
reserved number is needed.
@pdevito3

pdevito3 commented Nov 1, 2026

Copy link
Copy Markdown
Owner Author

Independent verification of 3ecca3e: PASS+NOTES

The goal is that a developer who runs scripts/new-feature.cs gets a list that a real caller can query by any text through filters on HTTP, MCP, and gRPC, with no search left. I checked that on a live isolated stack. I did not rely on the test claims in the PR.

Generated code

  • I ran dotnet run scripts/new-feature.cs -- Carrier --entrypoints http,grpc,mcp --fields "Name:text, Notes:text?, Code:text:public, MaxLoad:int" in a detached worktree of origin/refactor/new-feature-no-search.
  • I ran grep -i search over each generated or changed file. Its only hits are the Venue and Workshop example operations in openapi/FullstackTemplate.Server.json, which the later PR removes.
  • CarrierParametersDto.From(pageNumber, pageSize, filters, sortOrder) has no search. The handler has no ILike block. The HTTP handler has filters, sortOrder, pageNumber, pageSize. ListCarriersRequest has fields 1 to 4 and no field 5.
  • I ran the generator a second time with the same args. git diff --exit-code shows no change.

Live stack (ZeroFactor, launch.sh, isolated)

To set up the data, I signed in as admin@example.com, filled the Start a tenant form in the SPA, and sent POST /api/v1/carriers through the BFF with X-CSRF: 1. All 10 rows got 201: "Acme", Acme, 50% off, a_b, c\d, q"""q, and the controls 50x off, axb, cxd, ACME corp.

The HTTP, MCP, and gRPC calls gave the same rows for each filter:

filters HTTP GET /api/v1/carriers (BFF) MCP list_carriers gRPC ListCarriers
name @=* """ "Acme" """ "Acme" "Acme" "Acme"
name == """ "Acme" """ "Acme" not run not run
name == "Acme" Acme Acme Acme
name @=* "acme" "Acme", Acme, ACME corp not run "Acme", Acme, ACME corp
name @=* "50% off" 50% off (not 50x off) 50% off 50% off
name @=* "a_b" a_b (not axb) a_b a_b
name @=* "c\d" c\d (not cxd) c\d c\d
name @=* """ c\d """ c\d not run not run
name @=* """" q"""q """" q"""q q"""q q"""q
  • OpenAPI. The live GET {server}/openapi/v1.json and the committed doc give the parameters ['filters', 'sortOrder', 'pageNumber', 'pageSize'] for /api/v1/carriers.
  • MCP. I registered clinic-assistant as a delegated agent through POST /api/v1/agents with the BFF session, which returned 201. Then I got a password-grant token from ZeroFactor and sent initialize, tools/list, and tools/call to {server}/mcp. The list_carriers input schema has pageNumber, pageSize, filters, sortOrder. The filters description is the new text: ... Put text with a " in a raw string with one space on each side, for example: name @=* """ say "hi" """. Its delimiter is one quote more than the longest run of quotes in the text, and at least three quotes.
  • gRPC. I used grpcurl 1.9.3 with -plaintext -proto carriers.proto against the h2c grpc endpoint, with the same agent token. A request with {"search":"Acme"} fails on the client: ListCarriersRequest has no known field named search.

Tests I ran myself

The build has 0 warnings. These test runs passed: the Carrier tests in UnitTests (15/15), the Carrier tests in IntegrationTests (10/10, CarrierListQueryTests included), the Carrier tests in FunctionalTests (11/11, HTTP, MCP, and gRPC), and NewFeatureTextTests (12/12). I did not run the full solution or the examples-removed matrix leg.

Notes (not blockers for this PR)

  1. HTTP ignores an old search query param without an error: ?search=Acme returns 200 with all 10 rows. MCP does the same with a search argument. That is normal for ASP.NET binding and the MCP SDK, but a caller that still sends search silently gets an unfiltered list. It may deserve a line in the migration notes of the later PR.
  2. I ran only the four-field Carrier above, not the eight-field Carrier and the Shipment from the CI job.
  3. buf lint was not run. buf is not installed on this machine.

@pdevito3
pdevito3 merged commit b316466 into main Nov 1, 2026
13 checks passed
@pdevito3
pdevito3 deleted the refactor/new-feature-no-search branch November 1, 2026 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant